#
# Cmake instructions file
#
cmake_minimum_required(VERSION 2.8)
 
include(Properties.cmake)
 
project(${NAME} CXX)

file(GLOB SOURCE_FILES src/CppUTest/*.cpp)
file(GLOB SOURCE_FILES_EXT src/CppUTestExt/*.cpp)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "TI")
    
    add_definitions(-D=CPPUTEST_DONT_USE_EXCEPTIONS=1)
    
    file(GLOB PLATFORM_FILES src/Platforms/TiDsp/*.cpp)
    
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")

    file(GLOB PLATFORM_FILES src/Platforms/Gcc/*.cpp)

elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")

    include_directories("${PROJECT_SOURCE_DIR}/include/Platforms/VisualCpp")
	add_definitions(/FI Platform.h)
	add_definitions(/D _VC80_UPGRADE=0x0600)

    file(GLOB PLATFORM_FILES src/Platforms/VisualCpp/*.cpp)

else()

    message(FATAL_ERROR "Can not configure ${NAME} for ${CMAKE_CXX_COMPILER_ID}")
            
endif()

add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES} ${PLATFORM_FILES})
add_library(${PROJECT_NAME}Ext STATIC ${SOURCE_FILES_EXT})

include_directories("${PROJECT_SOURCE_DIR}/include")
	
file(GLOB HEADER_FILES include/CppUTest/*.h)
file(GLOB HEADER_FILES_EXT include/CppUTestExt/*.h)
install(FILES ${HEADER_FILES} DESTINATION include/CppUTest COMPONENT Headers)
install(FILES ${HEADER_FILES_EXT} DESTINATION include/CppUTestExt COMPONENT Headers)

include(SBE/AddCoverityTargets)
include(SBE/DeployDependencies)
set(INSTALL_LIBRARIES ${PROJECT_NAME} ${PROJECT_NAME}Ext)
include(SBE/AddInstallTarget)
include(SBE/AddUninstallTarget)
include(SBE/AddTagTarget)